Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes the code thread-safe. #32

Closed
wants to merge 1 commit into from

Conversation

xxxserxxx
Copy link
Contributor

@xxxserxxx xxxserxxx commented Mar 9, 2023

So, this adds no features, but it does ensure thread safety of the code base. It fixes #25

There are two areas this affects:

  1. tview, like most UI toolkits, has constraints about modifying view elements. This is documented by tview. I've wrapped these as best I could.
  2. The code is cavelier about sharing data between goroutines. There wasn't too much of this; it mainly affected the array Player.Queue, which was modified and read in different goroutines. This code adds control via an RWMutex. I considered, and rejected, accessors; there few enough similar uses to seem worth it.

It's probably rare for any users to hit any of these. I put this in while trying to debug a different issue, which it didn't solve... but this change makes the code safer, so...

@xxxserxxx
Copy link
Contributor Author

I've poked at this some more, fixed one bug, and rebased it onto the loglistCleanups branch. So I'm closing this.

@xxxserxxx xxxserxxx closed this Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

handleMpvEvents is not thread safe
1 participant